home *** CD-ROM | disk | FTP | other *** search
/ Champak 29 / Volume 29 - JOGO DISK .iso / Games / jungle_adventure.swf / scripts / __Packages / Checkpoint.as < prev    next >
Text File  |  2006-11-29  |  1KB  |  59 lines

  1. class Checkpoint extends SSObject
  2. {
  3.    var classID = SSGlobal.CLSID_CHECKPOINT;
  4.    var assetID = "Checkpoint";
  5.    var soundID = "Checkpoint";
  6.    var checkpointID = 0;
  7.    var depthLayer = 1;
  8.    var collected = false;
  9.    var editor_isItem = true;
  10.    var editor_name = "Checkpoint";
  11.    var editor_args_names = ["id"];
  12.    var editor_args_values = [Checkpoint.prototype.checkpointID];
  13.    var editor_args_types = ["number"];
  14.    var editor_args_options = [[0,1000,1]];
  15.    var editor_args_descriptions = [""];
  16.    var editor_args_mode = [0];
  17.    var editor_args_component = ["NumericStepper"];
  18.    var editor_canChangeFrame = false;
  19.    function Checkpoint(id, visible)
  20.    {
  21.       super();
  22.       if(id)
  23.       {
  24.          this.checkpointID = id;
  25.       }
  26.    }
  27.    function onAddToWorld()
  28.    {
  29.       this.world.addObject(this.zone = new SSZone(SSZone.SPHERE,20,this.zone_onCollide,this));
  30.       this.zone.moveBy(this.x,this.y,this.z);
  31.    }
  32.    function zone_onCollide(obj)
  33.    {
  34.       this.setCollected(obj);
  35.    }
  36.    function onAddDisplay()
  37.    {
  38.       if(this.collected)
  39.       {
  40.          this.target.gotoAndStop(this.target._totalframes);
  41.       }
  42.       else
  43.       {
  44.          this.target.gotoAndStop(1);
  45.       }
  46.    }
  47.    function setCollected(obj)
  48.    {
  49.       if(this.collected)
  50.       {
  51.          return undefined;
  52.       }
  53.       obj.setRestorePoint(this);
  54.       this.collected = true;
  55.       GameSound.playSound(this.soundID);
  56.       this.target.play();
  57.    }
  58. }
  59.